package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.math.BigDecimal;
import java.util.Map;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.tool.btn.PetPanelBtn;
import org.come.entity.Baby;

import com.tool.btn.BabyBtn;
import com.tool.pet.BabyProperty;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;



public class TestChildAttributeJpanel extends JPanel {

    private static JLabel labPetname;// 乳名
            private static JLabel labtemperament;// 气质
            private static JLabel labintelligence;// 智力
            private static JLabel labFame;// 名气
            private static JLabel labtreason;// 叛逆
            private static JLabel labfood;// 温饱
            private static JLabel labclose;// 亲密
            private JLabel labforce;// 内力
            private JLabel labendurance;// 耐力
            private JLabel labMorality;// 道德
            private JLabel labPlay;// 玩性
            private JLabel labLove;// 孝心
            private JLabel labfatigue;// 疲劳
            private JLabel labrisingmoney;// 养育金
    public static BabyBtn btnfollow,// 跟随
            btnStandbyapl,
            btnrelease1,
            btnStandby;// 待机

    public TestChildAttributeJpanel() {
        if("水墨UI".equals(MyIsif.getStyle())) {
            this.setPreferredSize(new Dimension(240, 215));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            // 乳名
            labPetname = new JLabel();
            labPetname.setBounds(56, 10, 167, 18);
            labPetname.setForeground(Color.WHITE);
            labPetname.setFont(new Font("微软雅黑", 0, 13));
            this.add(labPetname);
            // 气质
            labtemperament = new JLabel();
            labtemperament.setBounds(56, 31, 58, 18);
            labtemperament.setForeground(Color.WHITE);
            labtemperament.setFont(new Font("宋体", 1, 14));
            this.add(labtemperament);
            // 智力
            labintelligence = new JLabel();
            labintelligence.setBounds(56, 52, 58, 18);
            labintelligence.setForeground(Color.WHITE);
            labintelligence.setFont(new Font("宋体", 1, 14));
            this.add(labintelligence);
            // 名气
            labFame = new JLabel();
            labFame.setBounds(56, 73, 58, 18);
            labFame.setForeground(Color.WHITE);
            labFame.setFont(new Font("宋体", 1, 14));
            this.add(labFame);
            // 叛逆
            labtreason = new JLabel();
            labtreason.setBounds(56, 94, 58, 18);
            labtreason.setForeground(Color.WHITE);
            labtreason.setFont(new Font("宋体", 1, 14));
            this.add(labtreason);
            // 温饱
            labfood = new JLabel();
            labfood.setBounds(56, 115, 58, 18);
            labfood.setForeground(Color.WHITE);
            labfood.setFont(new Font("宋体", 1, 14));
            this.add(labfood);
            // 亲密
            labclose = new JLabel();
            labclose.setBounds(56, 136, 58, 18);
            labclose.setForeground(Color.WHITE);
            labclose.setFont(new Font("宋体", 1, 14));
            this.add(labclose);
            // 内力
            labforce = new JLabel();
            labforce.setBounds(164, 31, 58, 18);
            labforce.setForeground(Color.WHITE);
            labforce.setFont(new Font("宋体", 1, 14));
            this.add(labforce);
            // 耐力
            labendurance = new JLabel();
            labendurance.setBounds(164, 52, 58, 18);
            labendurance.setForeground(Color.WHITE);
            labendurance.setFont(new Font("宋体", 1, 14));
            this.add(labendurance);
            // 道德
            labMorality = new JLabel();
            labMorality.setBounds(164, 73, 58, 18);
            labMorality.setForeground(Color.WHITE);
            labMorality.setFont(new Font("宋体", 1, 14));
            this.add(labMorality);
            // 玩性
            labPlay = new JLabel();
            labPlay.setBounds(164, 94, 58, 18);
            labPlay.setForeground(Color.WHITE);
            labPlay.setFont(new Font("宋体", 1, 14));
            this.add(labPlay);
            // 孝心
            labLove = new JLabel();
            labLove.setBounds(164, 115, 58, 18);
            labLove.setForeground(Color.WHITE);
            labLove.setFont(new Font("宋体", 1, 14));
            this.add(labLove);
            // 疲劳
            labfatigue = new JLabel();
            labfatigue.setBounds(164, 136, 58, 18);
            labfatigue.setForeground(Color.WHITE);
            labfatigue.setFont(new Font("宋体", 1, 14));
            this.add(labfatigue);
            // 养育金
            labrisingmoney = new JLabel();
            labrisingmoney.setBounds(56, 156, 167, 18);
            labrisingmoney.setForeground(Color.WHITE);
            labrisingmoney.setFont(new Font("宋体", 1, 14));
            this.add(labrisingmoney);
            btnStandbyapl = new BabyBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY88, "取回");
            btnStandbyapl.setBounds(23, 181, 60, 26);
            this.add(btnStandbyapl);
            // 跟随
            btnfollow = new BabyBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "跟随");
            btnfollow.setBounds(23 +1 * 65, 181, 60, 26);
            this.add(btnfollow);
            btnStandby = new BabyBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "参战");
            btnStandby.setBounds(23 +2 * 65, 181, 60, 26);
            this.add(btnStandby);

            // 新增小孩弃养功能
            //  btnrelease1 = new BabyBtn(imageMap.getImgMap().get("B20"),"B20", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "弃养");
            // btnrelease1.setBounds(53, 181, 59, 24);
            // this.add(btnrelease1);
            // 新增小孩弃养功能
        }else{
            this.setPreferredSize(new Dimension(240, 215));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            // 乳名
            labPetname = new JLabel();
            labPetname.setBounds(56, 10, 167, 18);
            labPetname.setForeground(Color.WHITE);
            labPetname.setFont(new Font("微软雅黑", 0, 13));
            this.add(labPetname);
            // 气质
            labtemperament = new JLabel();
            labtemperament.setBounds(56, 31, 58, 18);
            labtemperament.setForeground(Color.WHITE);
            labtemperament.setFont(new Font("宋体", 1, 14));
            this.add(labtemperament);
            // 智力
            labintelligence = new JLabel();
            labintelligence.setBounds(56, 52, 58, 18);
            labintelligence.setForeground(Color.WHITE);
            labintelligence.setFont(new Font("宋体", 1, 14));
            this.add(labintelligence);
            // 名气
            labFame = new JLabel();
            labFame.setBounds(56, 73, 58, 18);
            labFame.setForeground(Color.WHITE);
            labFame.setFont(new Font("宋体", 1, 14));
            this.add(labFame);
            // 叛逆
            labtreason = new JLabel();
            labtreason.setBounds(56, 94, 58, 18);
            labtreason.setForeground(Color.WHITE);
            labtreason.setFont(new Font("宋体", 1, 14));
            this.add(labtreason);
            // 温饱
            labfood = new JLabel();
            labfood.setBounds(56, 115, 58, 18);
            labfood.setForeground(Color.WHITE);
            labfood.setFont(new Font("宋体", 1, 14));
            this.add(labfood);
            // 亲密
            labclose = new JLabel();
            labclose.setBounds(56, 136, 58, 18);
            labclose.setForeground(Color.WHITE);
            labclose.setFont(new Font("宋体", 1, 14));
            this.add(labclose);
            // 内力
            labforce = new JLabel();
            labforce.setBounds(164, 31, 58, 18);
            labforce.setForeground(Color.WHITE);
            labforce.setFont(new Font("宋体", 1, 14));
            this.add(labforce);
            // 耐力
            labendurance = new JLabel();
            labendurance.setBounds(164, 52, 58, 18);
            labendurance.setForeground(Color.WHITE);
            labendurance.setFont(new Font("宋体", 1, 14));
            this.add(labendurance);
            // 道德
            labMorality = new JLabel();
            labMorality.setBounds(164, 73, 58, 18);
            labMorality.setForeground(Color.WHITE);
            labMorality.setFont(new Font("宋体", 1, 14));
            this.add(labMorality);
            // 玩性
            labPlay = new JLabel();
            labPlay.setBounds(164, 94, 58, 18);
            labPlay.setForeground(Color.WHITE);
            labPlay.setFont(new Font("宋体", 1, 14));
            this.add(labPlay);
            // 孝心
            labLove = new JLabel();
            labLove.setBounds(164, 115, 58, 18);
            labLove.setForeground(Color.WHITE);
            labLove.setFont(new Font("宋体", 1, 14));
            this.add(labLove);
            // 疲劳
            labfatigue = new JLabel();
            labfatigue.setBounds(164, 136, 58, 18);
            labfatigue.setForeground(Color.WHITE);
            labfatigue.setFont(new Font("宋体", 1, 14));
            this.add(labfatigue);
            // 养育金
            labrisingmoney = new JLabel();
            labrisingmoney.setBounds(56, 156, 167, 18);
            labrisingmoney.setForeground(Color.WHITE);
            labrisingmoney.setFont(new Font("宋体", 1, 14));
            this.add(labrisingmoney);

            btnStandbyapl = new BabyBtn("inkImg/hongmu/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "取回");
            btnStandbyapl.setBounds(23, 181, 60, 26);
            this.add(btnStandbyapl);
            // 跟随
            btnfollow = new BabyBtn("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "跟随");
            btnfollow.setBounds(23 +1 * 65, 181, 60, 26);
            this.add(btnfollow);
            btnStandby = new BabyBtn("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "参战");
            btnStandby.setBounds(23 +2 * 65, 181, 60, 26);
            this.add(btnStandby);
        }

    }

    // 刷新界面
    public void showBaby(Baby baby, BigDecimal[] bigs) {
        if (baby == null) {
            labPetname.setText("");
            labtemperament.setText("");
            labintelligence.setText("");
            labFame.setText("");
            labtreason.setText("");
            labfood.setText("");
            labclose.setText("");
            labforce.setText("");
            labendurance.setText("");
            labMorality.setText("");
            labPlay.setText("");
            labLove.setText("");
            labfatigue.setText("");
            labrisingmoney.setText("");
            btnStandbyapl.setText("寄养");
            btnStandby.setText("跟随");
            btnStandby.setText("参战");
        } else {
            BigDecimal big = RoleData.getRoleData().getLoginResult().getBabyId();
            if (big == null) {
                big = new BigDecimal(-1);
            }
            if (big.compareTo(baby.getBabyid()) == 0) {
                ;
            }
            btnStandby.setText("待机");
            Map<String, Integer> maps = BabyProperty.getBabyProperty().getProperty(baby, bigs);
            labPetname.setText(baby.getBabyname());
            labtemperament.setText(maps.get("气质").toString());
            labintelligence.setText(maps.get("智力").toString());
            labFame.setText(maps.get("名气").toString());
            labtreason.setText(maps.get("叛逆").toString());
            labfood.setText(baby.getWenbao().toString());
            labclose.setText(baby.getQingmi().toString());
            labforce.setText(maps.get("内力").toString());
            labendurance.setText(maps.get("耐力").toString());
            labMorality.setText(maps.get("道德").toString());
            labPlay.setText(maps.get("玩性").toString());
            labLove.setText(maps.get("孝心").toString());
            labfatigue.setText(baby.getPilao().toString());
            labrisingmoney.setText(baby.getYangyujin().toString());
            BigDecimal bid = RoleData.getRoleData().getLoginResult().getBabyId();
            if (bid == null || bid.compareTo(baby.getBabyid()) != 0) {
                btnStandby.setText("参战");
            } else {
                btnStandby.setText("待机");
            }
            if(baby.getState()!=null && baby.getState().equals("1")) {
                btnStandbyapl.setText("取回");
            }else{
                btnStandbyapl.setText("寄养");
            }
        }
    }

    ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if("水墨UI".equals(MyIsif.getStyle())) {
            if (icon == null) {
                icon = new ImageIcon("inkImg/newbackground/B217.png");
            }
            g.drawImage(icon.getImage(), 0, 0, 240, 215, this);
        }else{
            if (icon == null) {
                icon = new ImageIcon("inkImg/hongmu/2/99_png.xy2uiimg.png");
            }
            g.drawImage(icon.getImage(), 0, 0, 240, 214, this);
        }
    }


	public static JLabel getLabPetname() {
        return labPetname;
    }

    public void setLabPetname(JLabel labPetname) {
        TestChildAttributeJpanel.labPetname = labPetname;
    }

    public static JLabel getLabtemperament() {
        return labtemperament;
    }

    public void setLabtemperament(JLabel labtemperament) {
        TestChildAttributeJpanel.labtemperament = labtemperament;
    }

    public static JLabel getLabintelligence() {
        return labintelligence;
    }

    public void setLabintelligence(JLabel labintelligence) {
        TestChildAttributeJpanel.labintelligence = labintelligence;
    }

    public static JLabel getLabFame() {
        return labFame;
    }

    public void setLabFame(JLabel labFame) {
        TestChildAttributeJpanel.labFame = labFame;
    }

    public static JLabel getLabtreason() {
        return labtreason;
    }

    public void setLabtreason(JLabel labtreason) {
        TestChildAttributeJpanel.labtreason = labtreason;
    }

    public static JLabel getLabfood() {
        return labfood;
    }

    public void setLabfood(JLabel labfood) {
        TestChildAttributeJpanel.labfood = labfood;
    }

    public static JLabel getLabclose() {
        return labclose;
    }

    public void setLabclose(JLabel labclose) {
        TestChildAttributeJpanel.labclose = labclose;
    }

    public JLabel getLabforce() {
        return labforce;
    }

    public void setLabforce(JLabel labforce) {
        this.labforce = labforce;
    }

    public JLabel getLabendurance() {
        return labendurance;
    }

    public void setLabendurance(JLabel labendurance) {
        this.labendurance = labendurance;
    }

    public JLabel getLabMorality() {
        return labMorality;
    }

    public void setLabMorality(JLabel labMorality) {
        this.labMorality = labMorality;
    }

    public JLabel getLabPlay() {
        return labPlay;
    }

    public void setLabPlay(JLabel labPlay) {
        this.labPlay = labPlay;
    }

    public JLabel getLabLove() {
        return labLove;
    }

    public void setLabLove(JLabel labLove) {
        this.labLove = labLove;
    }

    public JLabel getLabfatigue() {
        return labfatigue;
    }

    public void setLabfatigue(JLabel labfatigue) {
        this.labfatigue = labfatigue;
    }

    public JLabel getLabrisingmoney() {
        return labrisingmoney;
    }

    public void setLabrisingmoney(JLabel labrisingmoney) {
        this.labrisingmoney = labrisingmoney;
    }

}
